<?php
$config = [
    'id' => 'hahan',
    'language' => 'zh-CN',
    'basePath' => SYS_ROOT,
    'vendorPath' => VENDOR_ROOT,
    'bootstrap' => ['log'],
    'modules' => [
        'admin' => ['class' => 'app\modules\admin\Module'],
    ],
    //'extensions' => [],
    'as behaviors' => ['class' => 'app\behavior\AppBehavior'],
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
    ],
    'components' => [
        'db2' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'sqlite:' . SYS_ROOT . '/data.db',
        ],
        'assetManager' => require(__DIR__ . '/asset.php'),
        'log' => require(__DIR__ . '/log.php'),
        'urlManager' => require(__DIR__ . '/url.php'),
        'formatter' => [
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss',
            'dateFormat' => 'yyyy-MM-dd',
        ],
        'cache_db_schema' => require(__DIR__ . '/cache_db_schema.php'),
        'cache' => require(__DIR__ . '/cache.php'),
        'request' => [
            'cookieValidationKey' => APP_KEY,
        ],
        'errorHandler' => [
            'class' => 'app\components\BaseErrorHandler'
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => FALSE,
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.mailgun.org',
                'username' => 'postmaster@avhub8.com',
                'password' => '7b1084e93bdb31d6c3087142bf84239c-4497bd1d-63adb47f',
                'port' => '587',
                'encryption' => 'tls',
            ]
        ],
    ],
];

if (YII_ENV_DEV && is_dir(YII_GII)) {
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['*']
    ];
}
if (file_exists(__DIR__ . '/db.php')) {
    $config['components']['db'] = require(__DIR__ . '/db.php');
}
return $config;